<?

class Event
{

    function registerEventHandler($event_type,$callback) {
        $GLOBALS['__events__'][$event_type][] = $callback;
    }

    function dispatchEvent($event_type,$params) {
        if (isset($GLOBALS['__events__'][$event_type])) {
            foreach ($GLOBALS['__events__'][$event_type] as $func) {
                $params = call_user_func($func,$params);
            }
        }
        return $params;
    }

}

?>